package main

import (
	"fmt"
	"mime"
	"os"
	_ "gitee.com/tangrx/beeerp/routers"
	"gitee.com/tangrx/beego"
	"gitee.com/tangrx/beeerp/models"
	. "gitee.com/tangrx/beeerp/lib"
)

func main() {
	//初始化
	initialize();
	beego.Run()
	fmt.Println("Starting....")
	fmt.Println("Start ok")
}
func initialize() {
	mime.AddExtensionType(".css", "text/css")
	//判断初始化参数
	initArgs() 
	models.Connect() 
	beego.AddFuncMap("stringsToJson", StringsToJson)
}
func initArgs() {
	args := os.Args
	for _, v := range args {
		if v == "-syncdb" {
			models.Syncdb()
			os.Exit(0)
		}
	}
}